package com.example.taobaorating;

import androidx.annotation.IntegerRes;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;

import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RatingBar;
import android.widget.Toast;

public class starRating extends AppCompatActivity {

    RatingBar starBar;
    Button starBtn;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_star_rating);

        starBar  = (RatingBar)findViewById(R.id.ratingBar);
        starBtn = (Button)findViewById(R.id.ratingBtn);

        starBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                float result =  starBar.getRating();
                Toast.makeText(starRating.this,getStrResource(R.string.content_1)+" "+result+" "+getStrResource(R.string.content_2),Toast.LENGTH_LONG).show();
            }
        });


    }

    public String getStrResource(@StringRes int id)
    {
        return getResources().getString(id);

    }

}